package com.bs.web.rest;

import com.bs.domain.Cluster;
import com.bs.service.ClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by wenguangjia on 2017/8/31.
 */
@RestController
@RequestMapping("/api/cluster")
public class ClusterResource {
    @Autowired
    private ClusterService clusterService;

    @GetMapping("/query")
    public List<Cluster> findAll(){
        return clusterService.findAll();
    }

    @PostMapping("/save")
    public Cluster save(@RequestBody Cluster cluster){
        return clusterService.save(cluster);
    }

    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable Long id){
        clusterService.delete(id);
    }
}
